@<template>
  <div class="cart">
    <!-- //导航 -->
    <cart-nav />

    <!-- 购物车列表 -->
    
      <cart-item />
    
    <!-- 购物车商品汇总 -->
    <cart-bottom-bar  @toPay="toPay" :allPrice="priceAll"/>
  </div>
   
</template>

<script>
import CartNav from './childComps/CartNav.vue'
import CartItem from './childComps/CartItem.vue'
import CartBottomBar from './childComps/CartBottomBar.vue'
import { mapGetters } from 'vuex'
import { mapMutations } from 'vuex'

export default {
  components: {
    CartNav,
    CartItem,
    CartBottomBar,
    
  },
  computed: {
    ...mapGetters(["allPrice", "select","goodsList", "choseCount"]),
    allChose(){
      return this.select;
     
    },
    priceAll() {
      return this.allPrice
    },
    

  },
  methods: {
    ...mapMutations(["justFalse"]),
    toPay(){
      if(this.choseCount == 0) {
        // this.$toast.show('请先选择要结算的商品')
        this.$toast2.show('请选择要结算的商品')
      }else {
        this.$toast2.show('正在跳转付款页面...',3000)
      }
    }
  },

  //当用户离开购物车页面,所有选择都取消掉
  activated(){
    this.justFalse();
    
  }

}
</script>

<style scoped>
.cart {
  height: 100vh;
}
</style>